/* eslint-disable */
// @ts-ignore
import { queryOptions, useMutation } from '@tanstack/vue-query';
import type { DefaultError } from '@tanstack/vue-query';
import request from '@/utils/request';
import { CustomRequestOptions } from '@/interceptors/request';

import * as apis from './userCenter';
import * as API from './types';

/** 查询用户中心分页列表 GET /user_center */
export function userCenterGetQueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.UserCenterGetParams;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.userCenterGet(queryKey[1] as typeof options);
    },
    queryKey: ['userCenterGet', options],
  });
}

/** 新增认证申请 POST /user_center/application */
export function useUserCenterInsertMutation(options?: {
  onSuccess?: (value?: API.ResponseModelObject_) => void;
  onError?: (error?: DefaultError) => void;
}) {
  const { onSuccess, onError } = options || {};

  const response = useMutation({
    mutationFn: apis.userCenterInsert,
    onSuccess(data: API.ResponseModelObject_) {
      onSuccess?.(data);
    },
    onError(error) {
      onError?.(error);
    },
  });

  return response;
}

/** 查询用户收藏分页列表 GET /user_center/favorite */
export function userCenterGet3QueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.UserCenterGetParams;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.userCenterGet3(queryKey[1] as typeof options);
    },
    queryKey: ['userCenterGet3', options],
  });
}

/** 收藏 POST /user_center/favorite */
export function useUserCenterFavoriteMutation(options?: {
  onSuccess?: (value?: API.ResponseModelObject_) => void;
  onError?: (error?: DefaultError) => void;
}) {
  const { onSuccess, onError } = options || {};

  const response = useMutation({
    mutationFn: apis.userCenterFavorite,
    onSuccess(data: API.ResponseModelObject_) {
      onSuccess?.(data);
    },
    onError(error) {
      onError?.(error);
    },
  });

  return response;
}

/** 取消收藏 POST /user_center/favorite/remove */
export function useUserCenterRemoveFavoriteMutation(options?: {
  onSuccess?: (value?: API.ResponseModelObject_) => void;
  onError?: (error?: DefaultError) => void;
}) {
  const { onSuccess, onError } = options || {};

  const response = useMutation({
    mutationFn: apis.userCenterRemoveFavorite,
    onSuccess(data: API.ResponseModelObject_) {
      onSuccess?.(data);
    },
    onError(error) {
      onError?.(error);
    },
  });

  return response;
}

/** 查询检测项点分页列表 GET /user_center/item_point */
export function userCenterGet7QueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.UserCenterGetParams;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.userCenterGet7(queryKey[1] as typeof options);
    },
    queryKey: ['userCenterGet7', options],
  });
}

/** 查询检测项点类别列表 GET /user_center/item_point/category */
export function userCenterGet6QueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.UserCenterGetParams;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.userCenterGet6(queryKey[1] as typeof options);
    },
    queryKey: ['userCenterGet6', options],
  });
}

/** 用户中心登录 POST /user_center/login */
export function useUserCenterLoginMutation(options?: {
  onSuccess?: (value?: API.ResponseModelUserCenterLoginModel_) => void;
  onError?: (error?: DefaultError) => void;
}) {
  const { onSuccess, onError } = options || {};

  const response = useMutation({
    mutationFn: apis.userCenterLogin,
    onSuccess(data: API.ResponseModelUserCenterLoginModel_) {
      onSuccess?.(data);
    },
    onError(error) {
      onError?.(error);
    },
  });

  return response;
}

/** 查询用户中心产品分页列表 GET /user_center/product */
export function userCenterGet2QueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.UserCenterGetParams;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.userCenterGet2(queryKey[1] as typeof options);
    },
    queryKey: ['userCenterGet2', options],
  });
}

/** 查询用户中心产品类别列表 GET /user_center/product/category */
export function userCenterGetCategoryQueryOptions(options: {
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.userCenterGetCategory(queryKey[1] as typeof options);
    },
    queryKey: ['userCenterGetCategory', options],
  });
}

/** 查询用户中心产品详情 GET /user_center/product/detail */
export function userCenterGetProductQueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.UserCenterGetProductParams;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.userCenterGetProduct(queryKey[1] as typeof options);
    },
    queryKey: ['userCenterGetProduct', options],
  });
}

/** 查询质量科普分页列表 GET /user_center/science */
export function userCenterGet5QueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.UserCenterGetParams;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.userCenterGet5(queryKey[1] as typeof options);
    },
    queryKey: ['userCenterGet5', options],
  });
}

/** 查询质量科普类别列表 GET /user_center/science/category */
export function userCenterGet4QueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.UserCenterGetParams;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.userCenterGet4(queryKey[1] as typeof options);
    },
    queryKey: ['userCenterGet4', options],
  });
}

/** 查询质量科普详情 GET /user_center/science/detail */
export function userCenterGetScienceQueryOptions(options: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.UserCenterGetScienceParams;
  options?: CustomRequestOptions;
}) {
  return queryOptions({
    queryFn: async ({ queryKey }) => {
      return apis.userCenterGetScience(queryKey[1] as typeof options);
    },
    queryKey: ['userCenterGetScience', options],
  });
}

/** 用户中心请求短信 POST /user_center/sms */
export function useUserCenterRequestSmsMutation(options?: {
  onSuccess?: (value?: API.ResponseModelObject_) => void;
  onError?: (error?: DefaultError) => void;
}) {
  const { onSuccess, onError } = options || {};

  const response = useMutation({
    mutationFn: apis.userCenterRequestSms,
    onSuccess(data: API.ResponseModelObject_) {
      onSuccess?.(data);
    },
    onError(error) {
      onError?.(error);
    },
  });

  return response;
}
